<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    数字<input type="number" id="num">
    <button id="btn">输入</button>
    <div id="arr"></div>
    <script>
        // 在页面显示一串数组
        var arr1 = [1, 4, 7, 14, 26, 64, 124]
        arr.innerHTML = arr1
        btn.onclick = function () {
            // 获取num里的数值
            var num1 = num.value - 0
            //  获取的数值加到arr1数组中
            arr1.push(num1)
            //  排序号后输入到arr中
            arr.innerHTML = arr1.sort(function (a, b) {
                return a - b
            })
        }
    </script>
</body>

</html>